package com.example.concurrent.chapter14;

/**
 * @author Liuqz
 * @date 2018/11/25 20:54
 */
public enum EnumSingleton {

    INSTANCE;

    private byte[] data = new byte[1024];

    EnumSingleton() {
        System.out.println("INSTANCE will be initialized immediately");
    }

    public static void method() {
        //调用该方法则会主动调用EnumSigleton,INSTANCE将会被实例化
    }

    public static EnumSingleton getInstance() {
        return INSTANCE;
    }
}
